<template>
	<view>
		<view class="margin_top ffffff">
			<view class="flexleft padding_top">
				<view class="line margin_right2"></view>
				<view class="sanshier xiaohei fonweight">基本信息</view>
			</view>
			<view class="mainpadding">
				<view class="flexbetween xiaohei titletext">
					<view>缘主姓名</view>
					<view>{{dataAll.name}}({{dataAll.sex}})</view>
				</view>
				<view class="flexbetween xiaohei margin_top titletext">
					<view>出生公历</view>
					<view>{{dataAll.gongli}}</view>
				</view>
				<view class="flexbetween xiaohei margin_top titletext">
					<view>出生农历</view>
					<view>{{dataAll.nongli}}</view>
				</view>
				<view class="flexbetween xiaohei margin_top titletext">
					<view>上一节气</view>
					<view>{{dataAll.jieqi_pre}}</view>
				</view>
				<view class="flexbetween xiaohei margin_top titletext">
					<view>下一节气</view>
					<view>{{dataAll.jieqi_next}}</view>
				</view>
				<view class="flexbetween xiaohei margin_top titletext">
					<view>四柱</view>
					<view>{{dataAll.sizhu_info.year_gan}}{{dataAll.sizhu_info.year_zhi}} {{dataAll.sizhu_info.month_gan}}{{dataAll.sizhu_info.month_zhi}} {{dataAll.sizhu_info.day_gan}}{{dataAll.sizhu_info.day_gan}} {{dataAll.sizhu_info.hour_gan}}{{dataAll.sizhu_info.hour_zhi}}</view>
				</view>
				<view class="flexbetween xiaohei margin_top titletext">
					<view>旬空</view>
					<view>{{dataAll.xunkong_info.year_xunkong}}(年) 
					{{dataAll.xunkong_info.month_xunkong}}(月) 
					{{dataAll.xunkong_info.day_xunkong}}(日) 
					{{dataAll.xunkong_info.hour_xunkong}}(时)</view>
				</view>
				<view class="flexbetween xiaohei margin_top titletext">
					<view>旬首</view>
					<view>日空-{{dataAll.xunkong_info.day_xunkong}}({{dataAll.xunshou_info.day_xunshou}}旬) 时空-{{dataAll.xunkong_info.hour_xunkong}}({{dataAll.xunshou_info.hour_xunshou}}庚)</view>
				</view>
				<view class="flexbetween xiaohei margin_top titletext">
					<view>定局</view>
					<view>{{dataAll.dunju}} {{dataAll.dingju}} {{dataAll.panlei}}</view>
				</view>
				<view class="flexbetween xiaohei margin_top titletext">
					<view>值符</view>
					<view>{{dataAll.zhifu_info.zhifu_name}}落{{dataAll.zhifu_info.zhifu_luogong}}宫</view>
				</view>
				<view class="flexbetween xiaohei margin_top titletext">
					<view>值使</view>
					<view>{{dataAll.zhifu_info.zhishi_name}}落{{dataAll.zhifu_info.zhishi_luogong}}宫</view>
				</view>
			</view>
		</view>
		<view class="margin_top ffffff">
			<view class="flexleft padding_top">
				<view class="line margin_right2"></view>
				<view class="sanshier xiaohei fonweight">奇门遁甲盘</view>
			</view>
			<view class="mainpadding2s">
				<uni-table border emptyText="暂无更多数据">
					<uni-tr v-for="(item,index) in qmdjp" :key="index">
						<uni-td align="center" width="230rpx"  v-for="(ite,ind) in qmdjp[index]" :key="ind">{{ite.tianpan.jiuxing}} {{ite.tianpan.bashen}} {{ite.dipan.bashen}} {{ite.dipan.bagua}} 
						{{ite.renpan.bamen}} {{ite.dipan.sanqiliuyi}}
						</uni-td>
					</uni-tr>
				</uni-table>
			</view>
		</view>
		<view class="margin_top ffffff">
			<view class="flexleft padding_top">
				<view class="line margin_right2"></view>
				<view class="sanshier xiaohei fonweight">排盘简批</view>
			</view>
			<view class="mainpadding" v-for="(item,index) in dataAll.gong_pan" :key="index">
				<view class="sanshier xiaohei fonweight">{{item.renpan.bamen}}:</view>
				<view class="xiaohui titletext">
				[宫局]：{{item.description.gong_ju}}
				</view>
				<view class="xiaohui titletext">
				[宫局解析]：{{item.description.gong_ju_desc}}
				</view>
				<view class="xiaohui titletext">
				[落局解析]：{{item.description.luo_gong_desc}}
				</view>
			</view>
		</view>
		<view class="mainpadding margin_top6">
			<view class="bigbtn">返回重测</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				dataAll: {},
				qmdjp:[]
			}
		},
		onLoad(options) {
			let data = JSON.parse(decodeURIComponent(options.msg));
			console.log(data);
			this.getDetail(data)
		},
		methods: {
			getDetail(data) {
				httpRequest.request(data.url, 'POST', data.data).then(res => {
					if(res.code==1){
						this.dataAll = res.data
						this.qmdjp = this.chuliemo(res.data.gong_pan, 3)
					}else{
						httpRequest.toast(res.msg)
						setTimeout(()=>{
							uni.navigateBack(1)
						},1000)
					}
				}).catch(err => {})
			},
			chuliemo(arr, num) { //转化为num等分的数组
				var newArr = []
				for (var i = 0; i < arr.length; i += num) {
					newArr.push(arr.slice(i, i + num))
				}
				console.log(newArr);
				return newArr
			},
		}
	}
</script>

<style lang="scss" scoped>
	/deep/.uni-table-td {
		padding: 40rpx 60rpx !important;
	}
</style>